<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>申请书编辑</title>
	<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
	<script type="text/javascript"
			src="${res}/js/proposal/irisPrpPrepare.js"></script>
	<script type="text/javascript"
			src="${res}/js/validate/irisvalidator.js"></script>
	<script type="text/javascript"
			src="${res}/js/keyword/keywordtips.js"></script>
	<script type="text/javascript"
			src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>

	<style>
		textarea{overflow:auto;}
	</style>

	<script type="text/javascript">
		$(function(){
			queryflex();
		});
		/**
		 * 申请书提交方法
		 */


		var ctxpath = "${ctx}";
		var prcWin = new progressWin("${res}");//初始化遮罩层
		/**
		 * 页面初始化方法 所有的都定义在里面
		 */
		$(document).ready (function() {
			$("#wbox1").click(function() {
				check("check");
			});

			$("#wbox2").click(function() {

				check("check");

			});

			initControl();

			$("table.t_css").each(function(){
				$(this).find("tr").not(".cbTable tr").filter(":even").addClass("li_1");
				$(this).find("tr").not(".cbTable tr").filter(":odd").addClass("li_2");
			});
			$("table").addClass("table01");
			$("#checkbox_table_").removeClass("table01");
			$("#feaReport_upload").removeClass("table01");
			$('div').find("[id^='checkbox_dyn_']").find("tr").removeClass("li_1").removeClass("li_2");
			$('div').find("[id^='checkbox_dyn_']").find("td").css("border",'0px solid');

			window.setInterval("checkPdfStatus()", "10000");//检验申请书的pdf
			suppportMoney();
			setJjCheck();
		});

		$(document).ready(function() {
			fileInit("feaReport_upload","PDF");
			fileInit("prpContent_upload","PDF",null,"{'PDF':'51200'}");

			//fileInitAttach("attachAdd", "JPG,PDF", null, 20, "{'JPG':'3072','PDF':'3072'}");
			$("#prpContent_upload").find(".file").hide();//隐藏文本框
		});


		$(document).ready(function() {
			$("#org").attr("disabled","true");
			initDepartForComplete("org");
			initControl();
		});

		/**
		 * 申报日期默认为当前日期
		 */
		$(document).ready(function() {
			var nowDate = '${sercverSysDate1}';
			if($("#apply_date_curr").val()==""){
				$("#apply_date_curr").val(nowDate);
			}

		});

		/**
		 * 填写检查
		 */
		function check(type){

			setTotalAmt();

			validate($("#basic_info_dwsj"),"单位数据完善");

			validateByTabRow($("#gdgc"),"单位数据完善-->股东（或出资方）构成");

			checnkPersonNum();

			checnkPersonNumTwo();

			validate($("#psn_infoal"),"单位人员情况");

			validate($("#fzr_info"),"单位人员情况");

			validate($("#org_fund_info"),"财务基本情况-->资产情况");

			validate($("#fund_two_year"),"财务基本情况-->近两年财务情况");

			validateByTabRow($("#eq_table1"),"财务基本情况-->近两年仪器设备情况");

			validateByTabRow($("#cgcc4"),"近两年成果产出情况-->科技成果登记");

			validate($("#fragment-tab5"),"社会效益与影响");

			validate($("#summary2"),"机构运营管理");

			validateByTabRow($("#gzzd"),"机构运营管理-->主要管理、规章制度");

			validate($("#fragment-tab10"),"经费说明");

			validate($("#fragment-tab11"),"绩效目标");

			validate($("#performances"),"预期绩效目标表");





			prp_attach();
			if(!valResult()){
				irisValShowMsg($("#wbox1"));
				return false;
			}
			if(type=="check"){
				showBox($("#wbox1"), "300px", "200px", "检查通过","1:所有检查全部合格");
			}
			return true;
		}

		 function setTotalAmt(){
            $('#request_amt').val($("#request_amt").val());
        }


		function checnkPersonNum(){

			var numberPersonnel = $('span[name="organization_persons/job_yanfa"]').html().trim();
			var psn_doctor = $("#psn_doctor").val();
			var	psn_master = $("#psn_master").val();
			var	psn_bachelor = $("#psn_bachelor").val();
			var	psn_junior = $("#psn_junior").val();
			var	psn_other = $("#psn_other").val();

			var	psn_high_jz = $("#psn_high_jz").val();
			var	psn_middle_jz = $("#psn_middle_jz").val();
			var	psn_low_jz = $("#psn_low_jz").val();
			var	psn_hight_other_jz = $("#psn_hight_other_jz").val();
			/*if(psn_doctor =="" && psn_master =="" && psn_bachelor =="" && psn_junior =="" && psn_other =="" && psn_high_jz=='' && psn_middle_jz == '' && psn_low_jz == '' && psn_hight_other_jz ==''){
                return false;
            }*/
			if(psn_doctor==""){
				psn_doctor = 0;
			}
			if(psn_master==""){
				psn_master = 0;
			}
			if(psn_bachelor==""){
				psn_bachelor = 0;
			}
			if(psn_junior==""){
				psn_junior = 0;
			}
			if(psn_other==""){
				psn_other = 0;
			}
			if(psn_high_jz==""){
				psn_high_jz = 0;
			}
			if(psn_middle_jz==""){
				psn_middle_jz = 0;
			}
			if(psn_low_jz==""){
				psn_low_jz = 0;
			}
			if(psn_hight_other_jz==""){
				psn_hight_other_jz = 0;
			}
			var all =parseInt(psn_doctor)+parseInt(psn_master)+parseInt(psn_bachelor)+parseInt(psn_junior)+parseInt(psn_other) +parseInt(psn_high_jz)+parseInt(psn_middle_jz)+parseInt(psn_low_jz)+parseInt(psn_hight_other_jz);
			if(numberPersonnel != all){
				irisValaddMsg("单位人员情况-->自有研发人员学历各学历人数之和加上兼职研发人员之和必须等于研发人员数");
			}

		}
		function checnkPersonNumTwo(){
			var psn_high = $("#psn_high").val();
			var	psn_middle = $("#psn_middle").val();
			var	psn_low = $("#psn_low").val();
			var	psn_hight_other = $("#psn_hight_other").val();
			var psn_doctor = $("#psn_doctor").val();
			var	psn_master = $("#psn_master").val();
			var	psn_bachelor = $("#psn_bachelor").val();
			var	psn_junior = $("#psn_junior").val();
			var	psn_other = $("#psn_other").val();
			/*if(psn_high =="" && psn_middle =="" && psn_low =="" && psn_hight_other =="" && psn_doctor =="" && psn_master =="" && psn_bachelor =="" && psn_junior =="" && psn_other =="" ){
                return false;
            }*/
			if(psn_high==""){
				psn_high = 0;
			}
			if(psn_middle==""){
				psn_middle = 0;
			}
			if(psn_low==""){
				psn_low = 0;
			}
			if(psn_hight_other==""){
				psn_hight_other = 0;
			}
			if(psn_doctor==""){
				psn_doctor = 0;
			}
			if(psn_master==""){
				psn_master = 0;
			}
			if(psn_bachelor==""){
				psn_bachelor = 0;
			}
			if(psn_junior==""){
				psn_junior = 0;
			}
			if(psn_other==""){
				psn_other = 0;
			}
			var all2 =parseInt(psn_high)+parseInt(psn_middle)+parseInt(psn_low)+parseInt(psn_hight_other);
			var all3 =parseInt(psn_doctor)+parseInt(psn_master)+parseInt(psn_bachelor)+parseInt(psn_junior)+parseInt(psn_other)
			if(all3 != all2){
				irisValaddMsg("单位人员情况-->自有研发人员学历（人）之和必须等于自有研发人员技术职称（人）之和");
			}
		}

		function setJjCheck(){
			var objValue = $('input[name="if_tzjj"]:checked').val();
			if(objValue == 1){
				$("#jjmc").addClass("required");
				return true;
			}
			if(objValue == 2){
				$("#jjmc").removeClass("required");
				return false;
			}
		}

		/*选择表格显示和清除表格内容  */
		function suppportMoney(){
			var objValue = $('input[name="if_tzjj"]:checked').val();
			if(objValue == 1 || objValue == 2){

				if(objValue == 1){
					$("#suportMoney").show();
					return true;
				}
				if(objValue == 2){
					$("#suportMoney").hide();
					$("#tabFormSupportMoney").children('tr:gt(0)').remove();
					return false;
				}
			}else{
				$("#suportMoney").hide();
			}
		}
	</script>
	<style>
		textarea{overflow:   auto;}
	</style>
</head>
<body>

<c:set var="xmlstr" value="${xmlData}" scope="request"/>
<x:parse xml="${xmlstr}" var="xmlData"  scope="request" />
<input type="hidden" id="childDiv" class="thickbox"/>
<input type="hidden" id="filePath" value="${ctx}/file/ajax-filedownload?fileCode=" />
<input type="hidden" id="menuId" value="${param.menuId}" />
<input type="hidden" id="sysDate" value="${sercverSysDate}" />
<input type="hidden" id="today" value="${sercverSysDate1}" />

<div id="showMessage"></div>
<div id="content">
	<%-- <textarea rows="" cols="" val ="${xmlstr}"></textarea> --%>
	<cpt:helpTips key="prpedit" id="prpEditTips"></cpt:helpTips>
	<div class="clear_h15"></div>
	<div class="word_box" id="mainDiv">

		<!-- 公用的配置界面 ：保存、提交等button-->
		<jsp:include page="./prpeditmain_public_first.jsp"></jsp:include>

		<div class="bar_b">
			<input type="hidden" id="pdfStatus" value="${pdfStatus}" />
			<span class="right">版本号：<span name="proposal/prp_version" id="prp_version"><x:out select="$xmlData/data/proposal/prp_version" /></span></span>
		</div>
		<form method="post" id="mainForm">
			<input type="hidden" value="${grantCode}" id="grantCode"
				   name="grantCode">
			<input type="hidden" value="${posCode}" id="posCode" name="posCode">
			<input type="hidden" value="<iris:des3 code="${posCode}"></iris:des3>" id="posCodeDes" name="posCodeDes">
			<input type="hidden" value="<iris:des3 code="${fbl.pdfCode}"></iris:des3>" id="pdfCodeDes" name="pdfCodeDes">
			<input type="hidden" value="${xmlData}" id="xmlData" name="xmlData">
			<input type="hidden" value="${fbl.pdfCode}" id="pdfCode" name="pdfCode">
			<input type="hidden" value="${flag_shizhi}" id="flag_shizhi" name="proposal/flag_shizhi">
		</form>
		<div class="word_title">
			<c:set var="statYear">${statYear}</c:set>
			<c:if test="${empty statYear}">
				<c:set var="statYear"><x:out select="$xmlData/data/proposal/stat_year" /></c:set>
			</c:if>
			<input type="hidden" name="proposal/stat_year" value="${statYear}">
			<input type="hidden" name="proposal/grant_name" value="<x:out select="$xmlData/data/proposal/grant_name" />" />
			<span name="proposal/sub_grant_name" ><x:out select="$xmlData/data/proposal/sub_grant_name" /></span>-项目申报书 (<span name="proposal/stat_year">${statYear}</span>年)<%-- <br/><span name="proposal/sub_grant_name" >(<x:out select="$xmlData/data/proposal/sub_grant_name" />)</span> --%>

			<input type="hidden" name="proposal/request_amt" 	id="request_amt" value="<x:out select="$xmlData/data/proposal/request_amt"/>">
			<input type="hidden" name="proposal/manage_category" value="<x:out select="$xmlData/data/proposal/manage_category" />" />
			<input type="hidden" name="proposal/sub_grant_name" value="<x:out select="$xmlData/data/proposal/sub_grant_name" />" />
			<input type="hidden" name="proposal/grant_code" value="<x:out select="$xmlData/data/proposal/grant_code" />" />  <input type="hidden" name="proposal/psn_code" value="<x:out select="$xmlData/data/proposal/psn_code" />" />
			<input type="hidden" id="grant_no" name="proposal/grant_no" value="<x:out select="$xmlData/data/proposal/grant_no" />" />
			<input type="hidden" name="proposal/sub_grant_code" value="<x:out select="$xmlData/data/proposal/sub_grant_code" />" />
			<input name="proposal/register_area_code" type="hidden" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_value" />" />
			<input name="proposal/register_area_name" type="hidden" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/area_name" />" />
			<input type="hidden" id="sub_grant_no" name="proposal/sub_grant_no" value="<x:out select="$xmlData/data/proposal/sub_grant_no" />" />
			<input type="hidden" name="proposal/help_grant_code" value="<x:out select="$xmlData/data/proposal/help_grant_code" />" />
			<input type="hidden" id="help_grant_no" name="proposal/help_grant_no" value="<x:out select="$xmlData/data/proposal/help_grant_no" />" />
			<c:set var="formCode"><x:out select="$xmlData/data/proposal/form_code" /></c:set>
			<c:set var="nature_value"><x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" /> </c:set>
			<input type="hidden" name="organizations/organization/nature_value" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/nature_value" />">
			<c:if test="${empty formCode}"><c:set var="formCode" value="${param.formCode}"></c:set></c:if>
			<input type="hidden" name="proposal/form_code" value="${formCode}" />
			<input type="hidden" name="proposal/year" value="${year}" />
			<input type="hidden" name="proposal/zh_title" value="<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/org_name" />" />
			<input type="hidden" name="organization/whether_is_gaoxin_value" value="<x:out select="$xmlData/data/organization/whether_is_gaoxin_value" />"/>
			<input type="hidden" name="organization/whether_industrial_base_value" value="<x:out select="$xmlData/data/organization/whether_industrial_base_value" />"/>
			<input type="hidden" name="organization/whether_is_province_value" value="<x:out select="$xmlData/data/organization/whether_is_province_value" />"/>
			<!-- 公用的配置界面 -->
			<jsp:include page="./prpeditmain_public.jsp"></jsp:include>
		</div>
		<div id="tabnav">
			<ul>
				<li class="down" id="tab0" onclick="changeTab(this.id)">
					<a href="###"><span>填写说明</span></a>
				</li>

				<li  id="tab1" onclick="changeTab(this.id)" >
					<a href="###"><span>单位基本情况</span></a>
				</li>

				<li id="tab2" onclick="changeTab(this.id)" >
					<a href="###"><span>单位数据完善</span></a>
				</li>
				<li id="tab3" onclick="changeTab(this.id)" >
					<a href="###"><span>单位人员情况</span></a>
				</li>
				<li id="tab4" onclick="changeTab(this.id)" >
					<a href="###"><span>财务基本情况</span></a>
				</li>
				<li id="tab8" onclick="changeTab(this.id)" >
					<a href="###"><span>近两年科技项目情况</span></a>
				</li>
				<li id="tab9" onclick="changeTab(this.id)" >
					<a href="###"><span>近两年成果产出情况</span></a>
				</li>
			</ul>
		</div>
		<div id="tabnav">
			<ul>
				<li id="tab5" onclick="changeTab(this.id)"><a href="###"><span>社会效益与影响</span></a>
				</li>
				<li id="tab6" onclick="changeTab(this.id)"><a href="###"><span>机构运营管理</span></a>
				</li>
				<li id="tab10" onclick="changeTab(this.id)"><a href="###"><span>经费说明</span></a>
				</li>
				<li id="tab11" onclick="changeTab(this.id)"><a href="###"><span>绩效目标</span></a>
				</li>
				<li id="tab12" onclick="changeTab(this.id)"><a href="###"><span>预期绩效目标表</span></a>
				</li>
				<li id="tab7" onclick="changeTab(this.id)"><a href="###"><span>附件清单</span></a>
				</li>
			</ul>
		</div>
		<div class="tab_box" id="fragment-tab0">
			<jsp:include page="../info/prpinfo_xxyfjgjxpl_2021.jsp"></jsp:include>
		</div>
		<div class="tab_box" id="fragment-tab1" style="display: none">
			<jsp:include page="../org/prporg_baseinfo_enterprise_new_2020_2.jsp">
				<jsp:param value="单位基本信息" name="title"/>
				<jsp:param value="单位人员情况" name="title2"/>
				<jsp:param value="单位财务状况" name="title3"/>
				<jsp:param value="企业开展产学研合作情况" name="title4"/>
				<jsp:param value="主营业务产品" name="title5"/>
				<jsp:param value="知识产权情况" name="title6"/>
				<jsp:param value="${xmlstr}" name="xmlstr" />
				<jsp:param value="${statYear}" name="statyear" />
				<jsp:param value="${year}" name="curryear" />
			</jsp:include>
		</div>
		<!-- 单位数据完善 -->
		<div class="tab_box" id="fragment-tab2" style="display: none">
			<jsp:include page="../goal/prpgoaledit_xxyfjgjxpl_2021.jsp"></jsp:include>
		</div>
		<!-- 单位人员情况 -->
		<div class="tab_box" id="fragment-tab3" style="display: none">
			<jsp:include page="../org/prpgoaledit_xxyfjg_2020.jsp"></jsp:include>
		</div>
		<!-- 研发基本条件 -->
		<div class="tab_box" id="fragment-tab4" style="display: none">
			<jsp:include page="../fund/prpgoaledit_xxyfjg_2020.jsp">
				<jsp:param value="${statYear}" name="statYear"/>
			</jsp:include>
		</div>
		<!-- 上一年度科研项目情况 -->
		<div class="tab_box" id="fragment-tab8" style="display: none">
			<jsp:include page="../fund/prpgoaledit_xxyfjg_kyxm_2020.jsp">
				<jsp:param value="${statYear}" name="statYear"/>
			</jsp:include>
		</div>
		<!-- 上一年度成果产出情况 -->
		<div class="tab_box" id="fragment-tab9" style="display: none">
			<jsp:include page="../fund/prpgoaledit_xxyfjg_cgcc_2020.jsp">
				<jsp:param value="${statYear}" name="statYear"/>
			</jsp:include>
		</div>
		<!-- 社会效益与影响 -->
		<div class="tab_box" id="fragment-tab5" style="display: none">
			<jsp:include page="../goal/prpgoaledit_xxyfjg_shyx_2021.jsp"></jsp:include>
		</div>
		<!-- 机构运营管理 -->
		<div class="tab_box" id="fragment-tab6" style="display: none">
			<jsp:include page="../goal/prpgoaledit_xxyfjg_fzzl_2020.jsp"></jsp:include>
		</div>

		<!-- 经费说明 -->
		<div class="tab_box" id="fragment-tab10" style="display: none">
			<jsp:include page="../org/prporg_dfkyjctjhnljs_2019_02.jsp"></jsp:include>
		</div>

		<!-- 项目绩效目标-->
		<div class="tab_box" id="fragment-tab11" style="display: none">
			<jsp:include page="../org/prporgedit_achievements_comment_2019_02.jsp"></jsp:include>
		</div>

		<!-- 预期绩效目标表 -->
		<div class="tab_box" id="fragment-tab12" style="display: none">
			<jsp:include page="../org/prporg_xxyf_jxzb_2019.jsp"></jsp:include>
		</div>

		<!-- 需提交的材料 -->
		<div class="tab_box" id="fragment-tab7" style="display: none">
			<jsp:include page="../attach/prpAttachEdit_jcjj.jsp">
				<jsp:param value="${xmlstr}" name="xmlstr" />
				<jsp:param value="3.递交纸质材料时，提供系统打印的申请书纸质文件，连同以上附件材料（一式三份，A4规格，正反面打印，附有目录及页码，胶装成册），签字盖章后报送归口管理部门。" name="str1"/>
				<jsp:param value="4.递交纸质材料时，申报单位所在地归口管理部门校验以上附件材料。" name="str2"/>


			</jsp:include>
			<p style="font-size: 13px"><strong>备注：</strong></p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、递交纸质材料时，提供系统打印的申请书纸质文件，连同以上附件材料（一式三份，A4规格，正反面打印，附有目录及页码，胶装成册），签字盖章后报送归口管理部门</p>
			<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、递交纸质材料时，申报单位所在地归口管理部门校验以上附件材料</p>
			<!-- <p style="font-size: 13px"><strong>备注：</strong></p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、递交纸质材料时，提供系统打印的申请书纸质文件，一式三份，签字盖章后报送归口管理部门</p>
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、递交纸质材料时，申报单位所在地归口管理部门校验以上附件材料</p> -->
		</div>

		<!-- 公用的配置界面 ：保存、提交等button -->
		<jsp:include page="./prpeditmain_public_last.jsp"></jsp:include>
	</div>
	<div class="clear_h15"></div>
</div>
</body>

</html>